lua functions
helloz 4/3/2024 Unity3d
lua function life cycle
--initialize lua--
function Awake()
end
--when the object is activated
function OnEnable()
end
function Start()
end
--when the object is non activated
function OnDisable()
end
--Called when the lua script script is destroyed or updated
function OnDispose()
end
--Called when objects and scripts are destroyed
function OnDestroy()
end
function Update()
end
function FixedUpdate()
end
--Enter trigger range
function OnTriggerEnter(collider)
end
--Exit trigger range
function OnTriggerExit(collider)
end
--Enter Collision range
function OnCollisionEnter(collision)
end
--Exit Collision range
function OnCollisionExit(collision)
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47